package com.anyou.mall.goo.goods.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import com.anyou.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.anyou.common.core.domain.BaseEntity;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;

/**
 * goodSku对象 li_goods_sku
 *
 * @author ruoyi
 * @date 2023-09-16
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper=false)
@ApiModel(value = "goodSku")
@TableName(value = "goo_goods_sku")
public class LiGoodsSku extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("ID")
    private Long id;

    @ApiModelProperty(value = "商品id")
    private Long goodsId;

    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    @ApiModelProperty(value = "分类path")
    private String categoryPath;

    @ApiModelProperty(value = "计量单位")
    private String goodsUnit;
    /**
     * 上架状态（0上架 1下架）
     */
    @ApiModelProperty(value = "上架状态")
    private String marketEnable;

    @Max(value = 99999999, message = "价格不能超过99999999")
    @ApiModelProperty(value = "销售价格")
    private Double price;

    /*@Max(value = 99999999, message = "合伙人价格99999999")
    @ApiModelProperty(value = "合伙人价格")
    private Double partnerPrice;*/

    @ApiModelProperty(value = "浏览数量")
    private Integer viewCount;

    @ApiModelProperty(value = "购买数量")
    private Integer buyCount;

    @Max(value = 99999999, message = "库存不能超过99999999")
    @ApiModelProperty(value = "库存")
    private Integer quantity;

    @ApiModelProperty(value = "商品好评率")
    private Double grade;

    @ApiModelProperty(value = "原图路径")
    private String original;


    @ApiModelProperty(value = "评论数量")
    private Integer commentNum;

    @ApiModelProperty(value = "卖家id")
    private Long storeId;

    @ApiModelProperty(value = "卖家名字")
    private String storeName;

    /**
     * 审核状态（0待审核 1通过 2不通过）
     */
    @ApiModelProperty(value = "审核状态（0待审核 1通过 2不通过）")
    private String auditStatus;

    @ApiModelProperty(value = "审核信息")
    private String auditRemark;

    @ApiModelProperty(value = "下架原因")
    private String underMessage;

    @ApiModelProperty(value = "商品移动端详情")
    private String mobileIntro;

    @ApiModelProperty(value = "商品视频")
    private String goodsVideo;

    @ApiModelProperty(value = "是否为推荐商品（0否 1是）", required = true)
    private String appIndexStatus;

    @ApiModelProperty(value = "规格信息json", hidden = true)
/*    @JsonIgnore*/
    private String specs;

    @ApiModelProperty(value = "规格信息")
    private String simpleSpecs;

    @TableLogic( value = "0",delval = "2" )
    @ApiModelProperty(value = "（0代表存在 2代表删除）")
    private String delFlag;

    /** 规格组合值（json组装规格id和规格值id） */
    @ApiModelProperty("规格组合值（json组装规格id和规格值id）")
    private String specsCompose;

    @ApiModelProperty("规格id（规格id，多个以英文逗号分割）")
    private String specsIds;

    /**  */
    @ApiModelProperty("规格名字（规格名字，多个以英文逗号分割）")
    private String specsNames;

    /** 规格值（多个以英文逗号分割） */
    @ApiModelProperty("规格值（多个以英文逗号分割）")
    private String specsValue;

    @Override
    public Date getCreateTime() {
        if (super.getCreateTime() == null) {
            return new Date(1593571928);
        } else {
            return super.getCreateTime();
        }
    }

    /**
     * 设置规格商品的基本商品信息
     *
     * @param goods 基本商品信息
     */
    public LiGoodsSku(GooGoods goods) {
        //商品基本信息
        this.goodsId = goods.getGoodsId();
        this.goodsName = goods.getGoodsName();
        this.goodsVideo = goods.getGoodsVideo();
        this.categoryPath = goods.getCategoryPath();
        this.marketEnable = goods.getMarketEnable();
        this.mobileIntro = goods.getMobileIntro();
        this.goodsUnit = goods.getGoodsUnit();
        this.grade = 100D;
        //商品状态
        this.auditStatus = goods.getAuditStatus();
        //卖家信息
        this.storeId = goods.getStoreId();
        this.storeName = goods.getStoreName();
        this.appIndexStatus = goods.getAppIndexStatus();
    }



}
